<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>CPP11ThreadPool: blockingqueue.hpp 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="CPP.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">CPP11ThreadPool
   </div>
   <div id="projectbrief">C++11线程池</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">blockingqueue.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef BLOCKINGQUEUE_HPP</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define BLOCKINGQUEUE_HPP</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;</div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;mutex&gt;</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;queue&gt;</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &lt;condition_variable&gt;</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &lt;cassert&gt;</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;</div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &quot;runnable.hpp&quot;</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;</div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div><div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="classBlockingQueue.html">   14</a></span>&#160;<span class="keyword">class </span><a class="code" href="classBlockingQueue.html">BlockingQueue</a> {</div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;    <span class="keyword">public</span>:</div><div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#a42f821a61ba22ba27e6d1a434ab27eb2">   19</a></span>&#160;        <a class="code" href="classBlockingQueue.html#a42f821a61ba22ba27e6d1a434ab27eb2">BlockingQueue</a>()</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;            : _mutex(),</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;              _notEmpty(),</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;              _queue() {}</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#a265931efcceccd5c99ac76178507559b">   29</a></span>&#160;        <a class="code" href="classBlockingQueue.html#a265931efcceccd5c99ac76178507559b">BlockingQueue</a>(std::initializer_list&lt;T&gt;&amp; args)</div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;            : _mutex(),</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;              _notEmpty(),</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;              _queue{args} {}</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;        <a class="code" href="classBlockingQueue.html#a42f821a61ba22ba27e6d1a434ab27eb2">BlockingQueue</a>(<span class="keyword">const</span> <a class="code" href="classBlockingQueue.html">BlockingQueue</a>&amp;);</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        <a class="code" href="classBlockingQueue.html#a42f821a61ba22ba27e6d1a434ab27eb2">BlockingQueue</a>(<span class="keyword">const</span> <a class="code" href="classBlockingQueue.html">BlockingQueue</a>&amp;&amp; rh);</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;        <a class="code" href="classBlockingQueue.html">BlockingQueue</a>&amp; <a class="code" href="classBlockingQueue.html#aaee07bb9044a01b4cb0af75748795325">operator=</a>(<span class="keyword">const</span> <a class="code" href="classBlockingQueue.html">BlockingQueue</a> &amp;);</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;        <a class="code" href="classBlockingQueue.html">BlockingQueue</a>&amp; <a class="code" href="classBlockingQueue.html#aaee07bb9044a01b4cb0af75748795325">operator=</a>(<span class="keyword">const</span> <a class="code" href="classBlockingQueue.html">BlockingQueue</a>&amp;&amp;);</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#a93c17143222334c4e4fe7035d4068bd0">   69</a></span>&#160;        T <a class="code" href="classBlockingQueue.html#a93c17143222334c4e4fe7035d4068bd0">back</a>() {</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;            std::lock_guard&lt;std::mutex&gt; lk(_mutex);</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;            <span class="keywordflow">return</span> _queue.back();</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;        }</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div><div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#adc86e513ba273cfa07cf5293806df412">   79</a></span>&#160;        T <a class="code" href="classBlockingQueue.html#adc86e513ba273cfa07cf5293806df412">front</a>() {</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;            std::lock_guard&lt;std::mutex&gt; lk(_mutex);</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;            <span class="keywordflow">return</span> _queue.front();</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;        }</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;</div><div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#a1c824f8d644951d25bed9825794ddeae">   89</a></span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classBlockingQueue.html#a1c824f8d644951d25bed9825794ddeae">put</a>(<span class="keyword">const</span> T &amp;x) {</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;            std::lock_guard&lt;std::mutex&gt; lk(_mutex);</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;            _queue.push(x);</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;            _notEmpty.notify_one();</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;        }</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div><div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#acedd6887a4af752440fb2dcd04292fa3">  100</a></span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classBlockingQueue.html#acedd6887a4af752440fb2dcd04292fa3">put</a>(<span class="keyword">const</span> T&amp;&amp; x) {</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;            std::lock_guard&lt;std::mutex&gt; lk(_mutex);</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;            _queue.push(std::move(x));</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;            _notEmpty.notify_one();</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;        }</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;</div><div class="line"><a name="l00111"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#aac788baea510940fc40961a285bacc5f">  111</a></span>&#160;        T <a class="code" href="classBlockingQueue.html#aac788baea510940fc40961a285bacc5f">take</a>() {</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;            std::unique_lock&lt;std::mutex&gt; lk(_mutex);</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;            _notEmpty.wait(lk, [<span class="keyword">this</span>] {  <span class="keywordflow">return</span> !this-&gt;_queue.empty(); });</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;            assert(!_queue.empty());</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;            T <a class="code" href="classBlockingQueue.html#adc86e513ba273cfa07cf5293806df412">front</a>(std::move(_queue.front()));</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;            _queue.pop();</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;            <span class="keywordflow">return</span>  <a class="code" href="classBlockingQueue.html#adc86e513ba273cfa07cf5293806df412">front</a>;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;        }</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;</div><div class="line"><a name="l00127"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#a8efc43c38666a38402c39f772da63fcf">  127</a></span>&#160;        <span class="keywordtype">void</span> <a class="code" href="classBlockingQueue.html#a8efc43c38666a38402c39f772da63fcf">wait_and_pop</a>(T&amp; value) {</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;            std::unique_lock&lt;std::mutex&gt; lk(_mutex);</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;            _notEmpty.wait(lk, [<span class="keyword">this</span>] {<span class="keywordflow">return</span> !_queue.empty();});</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;            value = _queue.front();</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;            _queue.pop();</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;        }</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;</div><div class="line"><a name="l00139"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#a47a2d7726112b4e2d7b3f65a4e84aa06">  139</a></span>&#160;        <span class="keywordtype">bool</span> <a class="code" href="classBlockingQueue.html#a47a2d7726112b4e2d7b3f65a4e84aa06">try_pop</a>(T&amp; value) {</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;            std::lock_guard&lt;std::mutex&gt; lk(_mutex);</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;            <span class="keywordflow">if</span>(_queue.empty())</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;            value = std::move(_queue.front());</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;            _queue.pop();</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;        }</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;</div><div class="line"><a name="l00153"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#a733361d5721c6ba64af3e129921c43b0">  153</a></span>&#160;        <span class="keywordtype">size_t</span> <a class="code" href="classBlockingQueue.html#a733361d5721c6ba64af3e129921c43b0">size</a>()<span class="keyword"> const </span>{</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;            std::lock_guard&lt;std::mutex&gt; lk(_mutex);</div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;            <span class="keywordflow">return</span> _queue.size();</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;        }</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;</div><div class="line"><a name="l00163"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#a06f9211f5225bb6413f403e8d14ca7ce">  163</a></span>&#160;        <span class="keywordtype">bool</span> <a class="code" href="classBlockingQueue.html#a06f9211f5225bb6413f403e8d14ca7ce">is_empty</a>()<span class="keyword"> const </span>{</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;            std::lock_guard&lt;std::mutex&gt; lk(_mutex);</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;            <span class="keywordflow">return</span> _queue.empty();</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;        }</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;    <span class="keyword">private</span>:</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;        <span class="keyword">mutable</span> std::mutex _mutex;</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;        std::condition_variable _notEmpty;</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;        std::queue&lt;T&gt; _queue;</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;};</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div><div class="line"><a name="l00176"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#a2f2b1e4d887d77a81fddabd44c5cdbfd">  176</a></span>&#160;<a class="code" href="classBlockingQueue.html#a42f821a61ba22ba27e6d1a434ab27eb2">BlockingQueue&lt;T&gt;::BlockingQueue</a>(<span class="keyword">const</span> <a class="code" href="classBlockingQueue.html">BlockingQueue&lt;T&gt;</a>&amp; rh)</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;    : _mutex(),</div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;      _notEmpty() {</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;    std::lock_guard&lt;std::mutex&gt; lk(_mutex);</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;    this-&gt;_queue = rh._queue;</div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;}</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;</div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div><div class="line"><a name="l00184"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#a0d375ec5bec4f19887d0a4757d95e087">  184</a></span>&#160;<a class="code" href="classBlockingQueue.html#a42f821a61ba22ba27e6d1a434ab27eb2">BlockingQueue&lt;T&gt;::BlockingQueue</a>(<span class="keyword">const</span> <a class="code" href="classBlockingQueue.html">BlockingQueue&lt;T&gt;</a>&amp;&amp; rh)</div><div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;    : _mutex(),</div><div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;      _notEmpty() {</div><div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;    std::lock_guard&lt;std::mutex&gt; lk(_mutex);</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;    this-&gt;_queue = rh._queue;</div><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;}</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div><div class="line"><a name="l00191"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#abbe4440d6ed06d175925bba1f3c02312">  191</a></span>&#160;<a class="code" href="classBlockingQueue.html">BlockingQueue&lt;T&gt;</a>&amp; <a class="code" href="classBlockingQueue.html#aaee07bb9044a01b4cb0af75748795325">BlockingQueue&lt;T&gt;::operator=</a>(<span class="keyword">const</span> <a class="code" href="classBlockingQueue.html">BlockingQueue&lt;T&gt;</a>&amp;&amp; rh) {</div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;    std::lock_guard&lt;std::mutex&gt; lk(_mutex);</div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    this-&gt;_queue = rh._queue;</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;}</div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;</div><div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">typename</span> T&gt;</div><div class="line"><a name="l00197"></a><span class="lineno"><a class="line" href="classBlockingQueue.html#aaee07bb9044a01b4cb0af75748795325">  197</a></span>&#160;<a class="code" href="classBlockingQueue.html">BlockingQueue&lt;T&gt;</a>&amp; <a class="code" href="classBlockingQueue.html#aaee07bb9044a01b4cb0af75748795325">BlockingQueue&lt;T&gt;::operator=</a>(<span class="keyword">const</span> <a class="code" href="classBlockingQueue.html">BlockingQueue&lt;T&gt;</a> &amp; rh) {</div><div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;    std::lock_guard&lt;std::mutex&gt; lk(_mutex);</div><div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    this-&gt;_queue = rh._queue;</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;}</div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* BLOCKINGQUEUE_HPP */</span><span class="preprocessor"></span></div><div class="ttc" id="classBlockingQueue_html_aac788baea510940fc40961a285bacc5f"><div class="ttname"><a href="classBlockingQueue.html#aac788baea510940fc40961a285bacc5f">BlockingQueue::take</a></div><div class="ttdeci">T take()</div><div class="ttdoc">take 弹出队列元素 </div><div class="ttdef"><b>Definition:</b> blockingqueue.hpp:111</div></div>
<div class="ttc" id="classBlockingQueue_html_a93c17143222334c4e4fe7035d4068bd0"><div class="ttname"><a href="classBlockingQueue.html#a93c17143222334c4e4fe7035d4068bd0">BlockingQueue::back</a></div><div class="ttdeci">T back()</div><div class="ttdoc">back 得到最后一个元素 </div><div class="ttdef"><b>Definition:</b> blockingqueue.hpp:69</div></div>
<div class="ttc" id="classBlockingQueue_html_adc86e513ba273cfa07cf5293806df412"><div class="ttname"><a href="classBlockingQueue.html#adc86e513ba273cfa07cf5293806df412">BlockingQueue::front</a></div><div class="ttdeci">T front()</div><div class="ttdoc">front 得到第一个元素 </div><div class="ttdef"><b>Definition:</b> blockingqueue.hpp:79</div></div>
<div class="ttc" id="classBlockingQueue_html_a733361d5721c6ba64af3e129921c43b0"><div class="ttname"><a href="classBlockingQueue.html#a733361d5721c6ba64af3e129921c43b0">BlockingQueue::size</a></div><div class="ttdeci">size_t size() const</div><div class="ttdoc">size 返回元素个数 </div><div class="ttdef"><b>Definition:</b> blockingqueue.hpp:153</div></div>
<div class="ttc" id="classBlockingQueue_html_a42f821a61ba22ba27e6d1a434ab27eb2"><div class="ttname"><a href="classBlockingQueue.html#a42f821a61ba22ba27e6d1a434ab27eb2">BlockingQueue::BlockingQueue</a></div><div class="ttdeci">BlockingQueue()</div><div class="ttdoc">BlockingQueue 默认构造函数 </div><div class="ttdef"><b>Definition:</b> blockingqueue.hpp:19</div></div>
<div class="ttc" id="classBlockingQueue_html_acedd6887a4af752440fb2dcd04292fa3"><div class="ttname"><a href="classBlockingQueue.html#acedd6887a4af752440fb2dcd04292fa3">BlockingQueue::put</a></div><div class="ttdeci">void put(const T &amp;&amp;x)</div><div class="ttdoc">put 插入 </div><div class="ttdef"><b>Definition:</b> blockingqueue.hpp:100</div></div>
<div class="ttc" id="classBlockingQueue_html_a47a2d7726112b4e2d7b3f65a4e84aa06"><div class="ttname"><a href="classBlockingQueue.html#a47a2d7726112b4e2d7b3f65a4e84aa06">BlockingQueue::try_pop</a></div><div class="ttdeci">bool try_pop(T &amp;value)</div><div class="ttdoc">wait_and_pop 弹出队列元素 </div><div class="ttdef"><b>Definition:</b> blockingqueue.hpp:139</div></div>
<div class="ttc" id="classBlockingQueue_html_a265931efcceccd5c99ac76178507559b"><div class="ttname"><a href="classBlockingQueue.html#a265931efcceccd5c99ac76178507559b">BlockingQueue::BlockingQueue</a></div><div class="ttdeci">BlockingQueue(std::initializer_list&lt; T &gt; &amp;args)</div><div class="ttdoc">BlockingQueue 初始化列表构造函数 </div><div class="ttdef"><b>Definition:</b> blockingqueue.hpp:29</div></div>
<div class="ttc" id="classBlockingQueue_html_a06f9211f5225bb6413f403e8d14ca7ce"><div class="ttname"><a href="classBlockingQueue.html#a06f9211f5225bb6413f403e8d14ca7ce">BlockingQueue::is_empty</a></div><div class="ttdeci">bool is_empty() const</div><div class="ttdoc">is_empty 判断队列是否为空 </div><div class="ttdef"><b>Definition:</b> blockingqueue.hpp:163</div></div>
<div class="ttc" id="classBlockingQueue_html_a1c824f8d644951d25bed9825794ddeae"><div class="ttname"><a href="classBlockingQueue.html#a1c824f8d644951d25bed9825794ddeae">BlockingQueue::put</a></div><div class="ttdeci">void put(const T &amp;x)</div><div class="ttdoc">put 插入 </div><div class="ttdef"><b>Definition:</b> blockingqueue.hpp:89</div></div>
<div class="ttc" id="classBlockingQueue_html"><div class="ttname"><a href="classBlockingQueue.html">BlockingQueue</a></div><div class="ttdoc">BlockingQueue 阻塞队列(FIFO) </div><div class="ttdef"><b>Definition:</b> blockingqueue.hpp:14</div></div>
<div class="ttc" id="classBlockingQueue_html_a8efc43c38666a38402c39f772da63fcf"><div class="ttname"><a href="classBlockingQueue.html#a8efc43c38666a38402c39f772da63fcf">BlockingQueue::wait_and_pop</a></div><div class="ttdeci">void wait_and_pop(T &amp;value)</div><div class="ttdoc">wait_and_pop 弹出队列元素 </div><div class="ttdef"><b>Definition:</b> blockingqueue.hpp:127</div></div>
<div class="ttc" id="classBlockingQueue_html_aaee07bb9044a01b4cb0af75748795325"><div class="ttname"><a href="classBlockingQueue.html#aaee07bb9044a01b4cb0af75748795325">BlockingQueue::operator=</a></div><div class="ttdeci">BlockingQueue &amp; operator=(const BlockingQueue &amp;)</div><div class="ttdoc">operator= 赋值运算符 </div><div class="ttdef"><b>Definition:</b> blockingqueue.hpp:197</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
